#!/bin/bash

#停止存储服务
systemctl stop record_server.service
systemctl disable record_server.service

#部署可执行文件以及库文件到指定目录
mkdir /app/bin/ -p
mkdir /app/lib/ -p
mkdir /data/sensor_log -p
cp bin/* /app/bin/ -a
cp lib/* /app/lib/ -a
sudo chmod 777 /app/bin/*
ln -s /app/lib/libcurl.so.4.8.0 /app/lib/libcurl.so.4

#添加record服务到系统中
rm -rf /lib/systemd/system/record_server.service
rm -rf /etc/systemd/system/multi-user.target.wants/record_server.service

cp -arf record_server.service /lib/systemd/system/	
sudo chmod 777 /lib/systemd/system/record_server.service	
sync
sleep 1
systemctl enable record_server.service
systemctl daemon-reload
systemctl restart record_server.service
systemctl status record_server.service&

